import request from "@/utils/request";

export function login(username, password, channel) {
  return request({
    url: "/student/login",
    method: "post",
    data: {
      username,
      pwd: password,
      channel
    },
  });
}

// 复习通过
export function experiencePass(data) {
  return request({
    url: `/experienceWordTest/word/pass`,
    method: "post",
    data
  });
}

// 获取复习单词数据
export function experienceWordReviewSearch(data) {
  return request({
    url: `/experienceWordTest/word/search `,
    method: "post",
    data
  });
}

// 获取复习单词数据
export function experienceReview(id) {
  return request({
    url: `/experienceWordTest/word/review/num/${id}`,
    method: "get",
  });
}

// 获取体验单词错词单词库
export function experienceWordByUnitId(params, data) {
  return request({
    url: `/experienceWordTest/wordByUnitId`,
    method: "post",
    params,
    data,
  });
}

// 创建单词
export function experienceCreate(data) {
  return request({
    url: `/experienceWordTest/create`,
    method: "post",
    data,
  });
}

// 体验单词库更新单词状态
export function experienceEstimateWord(params, data) {
  return request({
    url: `/experienceWordTest/estimateWord`,
    method: "get",
    params,
    data,
  });
}

// 体验单词库单词做对与错
export function experienceWordExercise(params, data) {
  return request({
    url: `/experienceWordTest/wordExercise`,
    method: "get",
    params,
    data,
  });
}

// 获取体验单词库单元列表
export const getExperienceUnit = () => {
  return request({
    url: `/experienceWordTest/getExperienceUnit`,
    method: "get",
  });
};

// 记忆单词组获取
export const experiencefindWordPronunciationVo = (data) => {
  return request({
    url: `/experienceWordTest/findWordPronunciationVo`,
    method: "POST",
    data
  });
};

// 获取体验单词库单元列表数据
export const experienceCountWordNum = () => {
  return request({
    url: `/experienceWordTest/countWordNum`,
    method: "post",
  });
};

// 获取试卷
export const getHomeworkInfo = (params) => {
  return request({
    url: `/homeWork/getHomeworkInfo`,
    method: "get",
    params,
  });
};

// 获取试卷信息
export const getHomeworkParams = (params) => {
  return request({
    url: `/homeWork/getHomeworkParams`,
    method: "get",
    params,
  });
};

//课后作业首页
export const getHomeworkList = (data) => {
  return request({
    url: `/homeWork/getHomeWorkList`,
    method: "post",
    data,
  });
};

// 词义强化跳过
export function skipWordGroupRecord(params) {
  return request({
    url: `/studentWordGroupRecord/skipWordGroupRecord`,
    method: "get",
    params
  });
}

// 单词库获取复习列表
export function individualList(type) {
  return request({
    url: `/individual/word/review/num/list/${type}`,
    method: "get",
  });
}

export function findStudyProcess(data) {
  return request({
    url: "/StudyCentre/findStudyProcess",
    method: "post",
    data
  });
}

// 错题提交
export function updateStudentMistakeStatus(data) {
  return request({
    url: "/studentMistake/updateStudentMistakeStatus",
    method: "post",
    data,
  });
}
// 获取课程信息
export function findStudyCentreNum() {
  return request({
    url: "/StudyCentre/findStudyCentreNum",
    method: "post",
    data: {
      book_id: 0,
      class_id: 0,
    },
  });
}

export function getInfo() {
  return request({
    url: "/student/info",
    method: "get",
  });
}

// 获取学情信息
export const findStudyCentre = (data) => {
  return request({
    // http://192.168.119.10:8083
    url: `/StudyCentre/findStudyCentre`,
    method: "post",
    data,
  });
};

// 句子试卷生成
export function getSentenceByUnits(params) {
  return request({
    url: "/print/getSentenceByUnits",
    method: "get",
    params,
  });
}
// 生成试卷
export function getPaperData(data) {
  return request({
    url: "/test/create",
    method: "post",
    data,
  });
}
// 开始考试
export function startPaperTest(data) {
  return request({
    url: "/test/start",
    method: "post",
    data,
  });
}
// 校验试卷
export function checkPaperData(data) {
  return request({
    url: "/test/check",
    method: "post",
    data,
  });
}
//获取考试列表
export function getPaperList(data) {
  return request({
    url: "/test/list",
    method: "post",
    data,
  });
}
// 单词测试单词学习数据查询
export function getTestWordData(bookId) {
  return request({
    url: `/test/word/book_id/${bookId}/search`,
    method: "get",
  });
}
// 搜索今日复习单词
export function getTodayStrangeWord(data) {
  return request({
    url: `/strangeWord/getTodayStrangeWord`,
    method: "post",
    data,
  });
}

// 更新今日单词数据
export function updateStrangeWord(data) {
  return request({
    url: `/strangeWord/updateStrangeWord`,
    method: "post",
    data,
  });
}

// 搜索整体复习单词
export function getTotalStrangeWord(data) {
  return request({
    url: `/strangeWord/getTotalStrangeWord`,
    method: "post",
    data,
  });
}

// 更新整体单词数据
export function updateTotalStrangeWord(data) {
  return request({
    url: `/strangeWord/updateTotalStrangeWord`,
    method: "post",
    data,
  });
}

// ----------
// 搜索今日复习单词
export function getTodayStrangeWordForExperience(data) {
  return request({
    url: `/strangeWord/getTodayStrangeWordForExperience`,
    method: "post",
    data,
  });
}

// 更新今日单词数据
export function updateStrangeWordForExperience(data) {
  return request({
    url: `/strangeWord/updateStrangeWordForExperience`,
    method: "post",
    data,
  });
}

// 搜索整体复习单词
export function getTotalStrangeWordForExperience(data) {
  return request({
    url: `/strangeWord/getTotalStrangeWordForExperience`,
    method: "post",
    data,
  });
}

// 更新整体单词数据
export function updateTotalStrangeWordForExperience(data) {
  return request({
    url: `/strangeWord/updateTotalStrangeWordForExperience`,
    method: "post",
    data,
  });
}
// ----------

// 搜索复习单词
export function getMemoryReview(data) {
  return request({
    url: `/review/word/search`,
    method: "post",
    data,
  });
}
// 通过复习
export function setWordPass(data) {
  return request({
    url: `/review/word/pass`,
    method: "post",
    data,
  });
}
// 单词本
// http://192.168.119.97:8101/word/wordByUnitId?pageNum=1&=10&bookId=28
export function getWordList(params, data) {
  return request({
    url: `/word/wordByUnitId`,
    method: "post",
    params,
    data,
  });
}

// 单词本熟词
export function wordByUnitIdForStrange(params, data) {
  return request({
    url: `/word/wordByUnitIdForStrange`,
    method: "post",
    params,
    data,
  });
}
// http://192.168.119.97:8101/studentWordGroupRecord/findWordPronunciationVo?unitId=2231&phoneticCategory=0&bookId=7&source=1
export function getStudyWordList(params, data) {
  return request({
    url: `/studentWordGroupRecord/findWordPronunciationVo`,
    method: "get",
    params,
    data,
  });
}

// 首页数据
export function getHomeData(params, data) {
  return request({
    url: `/word/selectHomePage`,
    method: "get",
    params,
    data,
  });
}
// http://192.168.119.97:8101/word/estimateWord?wid=41¬=true&bookId=7&unitId=2231&category=0&wordId=131&groupId=14
export function setEstimateWord(params, data) {
  return request({
    url: `/word/estimateWord`,
    method: "get",
    params,
    data,
  });
}
// 单词强化校验结果
export function setWordExercise(params, data) {
  return request({
    url: `/word/wordExercise`,
    method: "get",
    params,
    data,
  });
}
// 获取章节列表
export function getUnitList(params, data) {
  return request({
    url: `/word/groupUnit`,
    method: "get",
    params,
    data,
  });
}
// 单词量测试数据
export function findTestRecord(params, data) {
  return request({
    url: `/vocabulary/findTestRecord`,
    method: "post",
    data,
    params,
  });
}

// 获取学生课程详情
export function getClassData(params, data) {
  return request({
    url: `/word/countWordNum`,
    method: "post",
    params,
    data,
  });
}
// 获取同步句子课程信息
export function countWordNumForSentence(params, data) {
  return request({
    url: `/word/countWordNumForSentence`,
    method: "post",
    params,
    data,
  });
}
// /review/word/book_id/{bookId}/num/list
export function getReviewNumber(bookId) {
  return request({
    url: `/review/word/book_id/${bookId}/num/list`,
    method: "get",
  });
}
// 获取一键智能学习的 单词速记王
export function get_isSkipSpeedChallenge_E(params) {
  return request({
    url: "/word/searchSmartReviewIsSkip",
    method: "get",
    params
  });
}
// 记录用户在线时长
export function setTimeEnglish(params) {
  return request({
    url: `/englishStudentOnline/addEnglishStudentOnline`,
    method: "post",
    params,
  });
}
//
export function getOnlineTime(data) {
  return request({
    url: `/englishStudentOnline/countDuration`,
    method: "post",
    data,
  });
}
// 查询unitId状态
export function getUnitStatusList(data) {
  return request({
    url: `/word/findBookDetails`,
    method: "post",
    data,
  });
}

// 查看同步句子unit
export function findBookDetailsForSentence(data) {
  return request({
    url: `/word/findBookDetailsForSentence`,
    method: "post",
    data,
  });
}
// 查询单词信息

export function getWordDataById(wordId) {
  return request({
    url: `/word/${wordId}`,
    method: "get",
  });
}
//查询每周学习情况
// http://192.168.119.97:8101
export function getStudyDataWeek(data) {
  return request({
    url: `/word/findWeekBookPlanVo`,
    method: "post",
    params: data,
  });
}
// 分类查询单词（课程进度）
export function getWordListByType(params, data) {
  return request({
    url: `/word/findNewWordBook`,
    method: "post",
    params,
    data,
  });
}
// 学完一组加学币
export function addIntegral(params, data) {
  return request({
    url: `/word/addIntegral`,
    method: "get",
    params,
    data,
  });
}
//再学一遍
export function studyAgain(params, data) {
  return request({
    url: `/word/addNumber`,
    method: "post",
    params,
    data,
  });
}

// 错题查询/study_progress/{bookId}/{articleQuestionType}/{pageSize}/{pageNum}/search
export function mistakesSearch(data) {
  return request({
    url: `/studentMistake/study_progress/search`,
    method: "post",
    data,
  });
}
//创建试卷
export function createReadPaper(data) {
  return request({
    url: `/article/test/create`,
    method: "post",
    data,
  });
}
export function createReadPaperUnit(data) {
  return request({
    url: `/article/test/create/unit`,
    method: "post",
    data,
  });
}
// 校验试卷
export function verifyReadPaper(data) {
  return request({
    url: `/article/test/check`,
    method: "post",
    data,
  });
}
// 开始考试
export function startReadPaper(testId) {
  return request({
    url: `/article/test/start/test_id/${testId}`,
    method: "post",
  });
}
//查询考试集合
export function getReadPaperTest(data) {
  return request({
    url: `/article/test/list`,
    method: "post",
    data,
  });
}
// http://localhost:8101/article/test/correct_rate/book/{bookId}/mode/{mode}/article_question_type/{articleQuestionType}/list
//查询近十天正确率
export function getAccuracyTen(data) {
  return request({
    url: `/article/test/correct_rate/book/${data.bookId}/mode/${data.mode}/article_question_type/${data.articleQuestionType}/list`,
    method: "get",
  });
}
// http://localhost:8101/article/test/study_progress/book/{bookId}/article_question_type/{articleQuestionType}/search
//查询首页阅读数据进度
export function getReadCenterData(data) {
  return request({
    url: `/article/test/study_progress/book/${data.bookId}/article_question_type/${data.articleQuestionType}/search`,
    method: "get",
  });
}
// 根据id查询阅读理解做题情况
export function getTestDataById(testId) {
  return request({
    url: `/article/test/test_id/${testId}`,
    method: "get",
  });
}

// 提交反馈
export function postFeedBack(data) {
  return request({
    url: `/englishWordFeedback/add`,
    method: "post",
    data,
  });
}
//通过单词出题目
export function getWordQuestions(data) {
  return request({
    url: "/word/question/create",
    method: "post",
    data,
  });
}
//查询发音训练列表
export function getTrainingList(data) {
  return request({
    url: `/sound/record/search`,
    method: "post",
    data,
  });
}
// http://localhost:8101/sound/save?word_id=121&word_name=testcc&is_child=1&accent=1
export function getTrainingScore(params, data) {
  return request({
    url: `/sound/save`,
    method: "post",
    params,
    data,
  });
}
// 单元单词再学一遍
export function postStudyAgain(data) {
  return request({
    url: "/word/unitWordAgain",
    method: "get",
    params: data,
  });
}
// 打印试卷接口
export function getPrintTest(data) {
  return request({
    url: "/test/print",
    method: "post",
    data,
  });
}
// 获取视频列表
export function getGrammarVideo(data) {
  return request({
    url: "/englishGrammar/findEnglishGrammar",
    method: "get",
    params: data,
  });
}
// 视频观看次数加一
export function addVideoWatchNum(data) {
  return request({
    url: "/englishStudentGrammarVideoNumber/add",
    method: "post",
    data,
  });
}
// 观看视频有效时长
export function addVideoWatchTime(data) {
  return request({
    url: "/englishStudentVideoValid/add",
    method: "post",
    data,
  });
}
// 生成语法试题试卷
export function getGrammarPaper(data) {
  return request({
    url: "/grammar/test/create",
    method: "post",
    data,
  });
}
// 验证语法试卷接口
export function verifyGrammarPaper(data) {
  return request({
    url: "/grammar/test/check",
    method: "post",
    data,
  });
}
// 查询语法试卷列表
export function getGrammarPaperList(data) {
  return request({
    url: "/grammar/test/list",
    method: "post",
    data,
  });
}
// 根据卷子Id查试卷详情
export function getGrammarPaperById(id) {
  return request({
    url: `/grammar/test/test_id/${id}`,
    method: "get",
  });
}
// 是否需要强制复习
export function getIsForce(bookId) {
  return request({
    url: `/word/isNeedReviewMemory/${bookId}`,
    method: "get",
  });
}
// 强制复习是否完成
export function setIsForce(bookId) {
  return request({
    url: `/word/finishReviewMemory/${bookId}`,
    method: "get",
  });
}

//获取每日学习单词数量
export const getStudentStudyWordInfo = (param) => {
  return request({
    url: `/word/getStudentStudyWordInfo`,
    method: "post",
    data: param,
  });
};

